import { _decorator, Component, Node, RigidBody2D, UITransform, v3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Ground')
export class Ground extends Component {

    @property({type:Node})
    private player:Node = null


    start() {
        
    }

    update(deltaTime: number) {
        if(this.player.position.x -  this.node.position.x > this.node.getComponent(UITransform).contentSize.x){
            // this.node.position = v3(this.player.position.x + this.node.getComponent(UITransform).contentSize.x,this.node.position.y,0)
            this.node.setPosition(this.node.position.x + (this.node.getComponent(UITransform).contentSize.x*2),this.node.position.y,0)

        }

    }
}


